import { request } from 'umi';
const postApiList = [
  //信息上报
  '/report/addReport', //事件上报-新增
  '/report/delReport', //信息上报删除
  '/report/getReport', //获取信息上报列表
  '/report/updateReport', //信息上报-修改
  '/report/showReport', //信息上报-查看
  '/report/dictItemList', //字典
];
const API = {};
postApiList.forEach((item) => {
  // 使用正则取到接口路径的最后一个子串，比如: getPublicKey
  const apiName = /[^/]+$/.exec(item)[0];
  if (apiName == 'exportExcel2') {
    API[apiName] = (data = {}) => {
      return request(item, {
        method: 'get',
        data,
      });
    };
  } else if (apiName) {
    API[apiName] = (data = {}) => {
      return request(item, {
        method: 'post',
        data,
      });
    };
  }
});
export default API;
